package com.zqxq.lottery.entity.o2o.user;

import com.zqxq.common.utils.DispatcherUtils;
import com.zqxq.lottery.entity.po.user.UserBcardPO;
import com.zqxq.lottery.entity.vo.user.UserBcardVO;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description ：
 * @Author ： 解风
 * @Date ： 2018/03/14 16:14
 */
public class UserBcardO2O {

    public static UserBcardVO toVO(UserBcardPO po) {
        if (po == null) {
            return null;
        }
        UserBcardVO userBcardVO = new UserBcardVO();
        userBcardVO.setId(DispatcherUtils.parseString(po.getId()));
        userBcardVO.setUserId(DispatcherUtils.parseString(po.getUser_id()));
        userBcardVO.setCardAccount(po.getCard_account());
        userBcardVO.setBankCard(po.getBank_card());
        userBcardVO.setBankKind(po.getBank_kind());
        userBcardVO.setBankSeat(po.getBank_seat());
        userBcardVO.setCardMobile(po.getCard_mobile());
        userBcardVO.setStatus(DispatcherUtils.parseString(po.getStatus()));
        userBcardVO.setCreateTime(DispatcherUtils.parseDateTimeStr(po.getCreate_time()));
        userBcardVO.setUpdateTime(DispatcherUtils.parseDateTimeStr(po.getUpdate_time()));
        return userBcardVO;
    }

    public static UserBcardPO toPO(UserBcardVO vo) {
        if (vo == null) {
            return null;
        }
        UserBcardPO userBcardPO = new UserBcardPO();
        userBcardPO.setId(DispatcherUtils.parseLong(vo.getId()));
        userBcardPO.setUser_id(DispatcherUtils.parseLong(vo.getUserId()));
        userBcardPO.setCard_account(vo.getCardAccount());
        userBcardPO.setBank_card(vo.getBankCard());
        userBcardPO.setBank_kind(vo.getBankKind());
        userBcardPO.setBank_seat(vo.getBankSeat());
        userBcardPO.setCard_mobile(vo.getCardMobile());
        userBcardPO.setStatus(DispatcherUtils.parseInteger(vo.getStatus()));
        userBcardPO.setCreate_time(DispatcherUtils.parseDateTime(vo.getCreateTime()));
        userBcardPO.setUpdate_time(DispatcherUtils.parseDateTime(vo.getUpdateTime()));
        return userBcardPO;
    }

    public static List<UserBcardVO> toVOList(List<UserBcardPO> list){
        List<UserBcardVO> result = new ArrayList();
        if(list != null && list.size() > 0){
            for (UserBcardPO po : list) {
                result.add(toVO(po));
            }
        }
        return result;
    }


}
